const Router=require('@koa/router')
const router=new Router()

const {auth}=require('../middleWare/auth')
const {verifyLogin}=require('../middleWare/verifyLogin')
const {verifyRegister}=require('../middleWare/verifyRegister')
const {verifyRecharge}=require('../middleWare/verifyRecharge')
const {verifyConvert}=require('../middleWare/verifyConvert')
const {verifyOrder}=require('../middleWare/verifyOrder')
const {uploadAvatar,verifyUploadAvatar}=require('../middleWare/verifyImage')
const {verifyWxpay}=require('../middleWare/verifyWxpay')

const loginController=require('../controller/login.controller')
const registerController=require('../controller/register.controller')
const sportsController=require('../controller/sports.controller')
const serviceController=require('../controller/service.controller')
const userController=require('../controller/user.controller')
const rechargeController=require('../controller/recharge.controller')
const convertController=require('../controller/convert.controller')
const codekeyController=require('../controller/codekey.controller')
const orderController=require('../controller/order.controller')
const fileController=require('../controller/file.controller')
const wxpayController=require('../controller/wxcode.controller')

router.post('/login',verifyLogin,loginController.login)
router.post('/register',verifyRegister,registerController.register)
router.get('/user',auth,userController.user)
router.get('/sports',sportsController.sports)
router.get('/service',auth,serviceController.service)
router.put('/recharge',auth,verifyRecharge,rechargeController.recharge)
router.post('/convert',auth,verifyConvert,convertController.convert,rechargeController.recharge)
router.get('/codeKey',codekeyController.codeKey)
router.get('/stadium',codekeyController.stadium)
router.post('/order',auth,verifyOrder,orderController.order)
router.get('/order',auth,orderController.orderAll)
router.post('/image',auth,uploadAvatar,verifyUploadAvatar,fileController.read)

// router.post('/wxpay',auth,verifyWxpay,wxpayController.getAccessTokenFun)

module.exports=router